﻿using Microsoft.EntityFrameworkCore;
using System.Text;
using 天离安全_天擎.Tl_EntitySqlIte;

namespace 天离安全_天擎.Tl_SerVices
{
    /// <summary>
    /// 密码爆破服务
    /// </summary>
    public class CrackPassWord_Services
    {
        private readonly AppDbContext _dbContext;
        /// <summary>
        /// 注册服务
        /// </summary>
        /// <param name="dbContext"></param>
        public CrackPassWord_Services(AppDbContext dbContext)
        {
            _dbContext = dbContext;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public async Task<(List<Tl_DbContext_Api.Mysql_PassWord> Items, int TotalCount)> GetMysqlPasswordsAsync(int page, int pageSize = 100)
        {
            var totalCount = await _dbContext.tl_mysql_password.CountAsync();
            var items = await _dbContext.tl_mysql_password
                .Skip((page - 1) * pageSize)
                .Take(pageSize)
                .ToListAsync();

            return (items, totalCount);
        }
    }
}
